import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xinxuan/common/appbar_util.dart';
import 'package:xinxuan/common/scroll_configuration_common.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:xinxuan/controllers/login_controller/login_page_controller.dart';
import 'package:xinxuan/utils/color_util.dart';
import 'package:xinxuan/views/login/login_page_password.dart';
import 'package:xinxuan/views/login/login_page_sms.dart';

class LoginPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: bgWhiteColor,
      appBar: AppBarUtil(
        title: '登录',
        backgroundColor: pageBgColor,
      ),
      body: GestureDetector(
        onTap: () {
          FocusScope.of(context).requestFocus(FocusNode());
        },
        child: ScrollConfigurationCommon(child: ListView(
          children: [
            Container(
              alignment: Alignment.center,
              margin: EdgeInsets.only(top: 40.h, bottom: 60.h),
              child: Text(
                '欢迎登录星力优选',
                style: TextStyle(
                  color: textBlackColor,
                  fontWeight: FontWeight.bold,
                  fontSize: 24.sp
                ),
              ),
            ),
            GetBuilder<LoginPageController>(
              init: LoginPageController(),
              builder: (controller) {
                return Obx(() => controller.loginType.value == 0 ? LoginPagePassword(loginPageController: controller) : LoginPageSms(loginPageController: controller));
              },
            )
          ],
        )),
      ),
    );
  }
}